import { awaitCache } from '@/utils/request'
const websocket = {
  state: {
    // 支付数据
    payment: undefined,
  },

  mutations: {
    // 支付数据
    PAYMENT: (state, data) => {
      state.payment = data
    }
  },

  actions: {
    HandleReactiveResponse({ commit }, content) {
      const messageId = content.messageId
      const resolve = awaitCache.get(messageId)
      if (typeof resolve === 'function') {
        resolve(content)
      }
    }
  }
}

export default websocket
